


        var cancelInt = null;
        function addClass(ele,addname){
            if(!ele.className){
                // class非空的时候,再判断要添加的类目是不是已经存在
                ele.className = addname;
                //class名为空的时候,直接赋值           
            }else{
                //非空
                if(!isHasClassName(addname,ele.className.split(" "))){
                    //不存在要添加的class名
                    ele.className += " " + addname;
                }
    
            }
            function isHasClassName(target,arr){
                for(var i in arr){
                    if(target === arr[i]){
                        return true;
                    }
                }
            } 
        }
        function removeClass(ele,classname){
             ele.className = ele.className.replace(classname,"");
        }
    
        function touch(event) {
            /**兼用 IE 浏览器*/
            var event = event || window.event;
            var oInp = document.getElementById("inp");
            var This = this;

            switch (event.type) {
                case "touchstart":
                    This.startX = event.touches[0].clientX;
                    addClass(This,'noTrans');
                    console.log("started (" + event.touches[0].clientX + "," + event.touches[0].clientY + ")");
                    break;
                case "touchend":
                    var rightVal = This.startX - event.changedTouches[0].clientX + This.right;
                    removeClass(This,'noTrans');
                    setTimeout(function(){
                        if(rightVal >= $('#contn .palace .item .del').eq(0).width() / 3 && !This.candel){
                            This.candel = true;
                            This.right = $('#contn .palace .item .del').eq(0).width();
                            This.style.right = This.right + 'px';
                            //addClass(This.parentNode,'candel');
                        }else if(rightVal < $('#contn .palace .item .del').eq(0).width() / 3 || This.candel){
                            This.candel = false;
                            This.right = 0;
                            This.style.right = '';
                        }
                    },10)
                    console.log("end (" + event.changedTouches[0].clientX + "," + event.changedTouches[0].clientY + ")");
                    break;
                case "touchmove":
                    var rightVal = This.startX - event.touches[0].clientX + This.right;
                    if(rightVal < 0){
                        rightVal = 0
                    }else if(rightVal > This.offsetWidth - $('#contn .palace .item .del').eq(0).width()){
                        rightVal = $('#contn .palace .item .del').eq(0).width();
                    }
                    This.style.right = rightVal + 'px';
                    console.log("moving (" + event.touches[0].clientX + "," + event.touches[0].clientY + ")");
                    break;
            }
        }

        function cancelDel(ind){

        }

        $(document).ready(function(){
            for(var a = 0;a < $('#contn .palace .item .inner').length;a++){
                $('#contn .palace .item .inner')[a].ind = a;
                $('#contn .palace .item .inner')[a].right = 0;
                $('#contn .palace .item .inner')[a].candel = false;
                $('#contn .palace .item .inner')[a].addEventListener('touchstart', touch, false);
                $('#contn .palace .item .inner')[a].addEventListener('touchmove', touch, false);
                $('#contn .palace .item .inner')[a].addEventListener('touchend', touch, false);
            }
            $('#contn .palace .item .inner').click(function(){
                window.location.href = 'chatWindow.html';
            })
            
        })